home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / cp1.zip / MEMCOPY.ASM < prev    next >
Assembly Source File  |  1993-04-10  |  4KB  |  94 lines

  1. ===========================================================================
  2.  BBS: The Abacus * HST/DS * Potterville, MI
  3. Date: 04-07-93 (16:07)             Number: 267
  4. From: MARK BUTLER                  Refer#: NONE
  5.   To: WAYNE VENABLES                Recvd: NO  
  6. Subj: Memcopy                        Conf: (35) Quick Basi
  7. ---------------------------------------------------------------------------
  8. Once upon a time Wayne Venables uttered these sage words to All:
  9.  
  10.  WV> I really need a good memory copy routine with...
  11.  
  12.  WV>         Source Segment/Offset
  13.  WV>         Destination Segment/Offset
  14.  WV>         Number of bytes to copy
  15.  
  16.  WV>  I remember a memcopy.obj that was posted here a while ago,
  17.  WV> can anybody  repost!!!
  18.  
  19.  Coming right up! This little ASM goodie was written by Brent Ashley and
  20.  has work extremely well for me and the QB declaration is precisely what
  21.  you said you wanted.
  22.  
  23. ==========================8< Cut Here 8<=============================
  24.   PAGE 56,132
  25.  TITLE MemCopy.ASM - QuickBasic callable memory block copy bin file
  26.  ;
  27.  ; MemCopy.ASM - (C)1991 by Brent Ashley
  28.  ; Copies blocks of memory quickly - to be used for screen saves.
  29.  ;
  30.  ; QB/QBX declaration:
  31.  ;
  32.  ; DECLARE SUB MemCopy (FromSeg%, FromOfs%, ToSeg%, ToOfs%, Count%)
  33.  
  34.  .MODEL medium, BASIC
  35.  .CODE
  36.  
  37.  MemCopy PROC USES si di ds es, FromSeg:PTR WORD, FromOfs:PTR WORD, \
  38.                                ToSeg:PTR WORD, ToOfs:PTR WORD, \
  39.                                Count:PTR WORD
  40.  
  41.  ; load ds:si with source, es:di with destination
  42.  mov bx,FromOfs
  43.  mov si,[bx]
  44.  mov bx,ToSeg
  45.  mov es,[bx]
  46.  mov bx,ToOfs
  47.  mov di,[bx]
  48.  mov bx,Count
  49.  mov cx,[bx]
  50.  
  51.  ; ds last (used to access data)
  52.  mov bx,FromSeg
  53.  mov ds,[bx]
  54.  
  55.  ; do the copy
  56.  cld
  57.  rep movsb
  58.  
  59.  ret
  60.  
  61.  MemCopy  ENDP
  62.  
  63.  END
  64. ==========================8< Cut Here 8<=============================
  65.  Now, if you don't happen to have MASM or TASM to assemble it with
  66.  here's a little PostIt! script to recompile MEMCOPY.OBJ
  67. ==========================8< Cut Here 8<=============================
  68.  '** Save this script to a file, edit out all of the non-QB related
  69.  '** text and execute it in a QB environment to retrieve MEMCOPY.OBJ
  70.  CLS:?STRING$(50,177):?"Creating:MEMCOPY.OBJ with PostIt! v2.9f"
  71.  DEFINT A-Z:FOR A=0 TO 6:P(A)=2^A:NEXT:OPEN "B",1,"MEMCOPY.OBJ"
  72.  T$="abcdefghijklmnopqrstuvwxyz":T$=T$+UCASE$(T$)+"0123456789()"
  73.  G"a2aal0wzTn2BWLNlHnxB)Bjlaaadnvutd9euz9fvfHfvf8frbrvqgq0rs9uvqvW
  74.  G"xuvewurarbrvqem0tevuoyEaaibaafCqamG5baGeaamGbb8aMhaasRaGahea5As
  75.  G"aae8VaDbPdaaWah0urnn0tqLfaaaGpisaaaiAard6lamaaau1ISB1vEyWIEXWI3
  76.  G"SOxk44bl6fcl(ZIEzWIpSOxo44h8ppPh8XxE1LYkaWWkkaaaqh"
  77.  N=179:K=255:IF LEN(C$)<>239 THEN ?"Incomplete script file!":BEEP:END
  78.  FOR A=1 TO N:IF L=0 THEN GOSUB G:L=6:LOCATE 1:?STRING$((51&*A)\N,8)
  79.  W=T\P(6-L):GOSUB G:W=W OR T*P(L):L=L-2:B$=CHR$(W AND K):PUT 1,,B$:NEXT
  80.  ?:IF C<>22 THEN ?"Bad checksum!":BEEP:END ELSE ?"Success!":END
  81.  G:I=I+1:T=INSTR(T$,MID$(C$,I,1))-1:C=(C+T)*2:C=C\256+(C AND 255):RETURN
  82.  SUB G(A$):SHARED C$:C$=C$+LEFT$(A$,63):END SUB
  83. ==========================8< Cut Here 8<=============================
  84.  
  85.  Hope this helps :-)
  86.  
  87. ·∙■[-M-H-B-]■∙·
  88.  
  89. --- timEd/B8 * "Milhouse, we live in the age of cooties!" -Bart Simpson
  90.  * Origin:  MotherShip Portholes, Portland OR  (1:105/330.5)
  91. SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
  92. SEEN-BY: 153/752 154/40 77 157/2 159/100 125 430 575 950 203/23 209/209
  93. SEEN-BY: 280/1 390/1 396/1 15 397/2 2230/100 3603/20
  94.